<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ include file="/views/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>晒羊毛-撸羊毛有风险，投资需谨慎</title>
	<link rel="stylesheet" type="text/css" href="<%=path %>/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="<%=path %>/css/style.min.css">
	<link rel="stylesheet" type="text/css" href="<%=path %>/js/plugins/datapicker/datepicker3.css">
	<link rel="stylesheet" type="text/css" href="<%=path %>/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css">
	<link rel="stylesheet" type="text/css" href="<%=path %>/css/sym.css">
	<script type="text/javascript" src="<%=path %>/js/jquery.min.js"></script>
	<script type="text/javascript" src="<%=path %>/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="<%=path %>/js/plugins/datapicker/bootstrap-datepicker.js"></script>
	<script type="text/javascript" src="<%=path%>/js/layer/layer.js"></script>
	<script type="text/javascript" src="<%=path %>/js/common.js"></script>
</head>
<body class="gray-bg">
<jsp:include page="/views/commons/header.jsp"></jsp:include>

	<div class="layout ">
		<div class="mb20">
			<div class="hbox">
				<div class="hd">
					<h3>平台失信录</h3>
				</div>
				<div class="bd clearfix">
					<form class="form-horizontal activity_box" id="news_form" action="javascript:insertNews()">
						<input type="hidden" name="newsId" value="${news.newsId}"/>
						<div class="form-group">
							<label class="col-sm-2 control-label">标题：</label>
							<div class="col-sm-9">
								<input type="text" class="form-control" placeholder="标题" name="newsTitle" value="${news.newsTitle}"></div>
						</div>
						<d:radio describe="新闻类型:" tableColumn="news_type" fieldName="newsType" value="${news.newsType}"></d:radio>
						<div class="form-group">
							<label class="col-sm-2 control-label">来源：</label>
							<div class="col-sm-9">
								<input type="text" class="form-control" placeholder="来源" name="newsFrom" value="${news.newsFrom}"></div>
						</div>
						<div class="form-group" id="data_news_time">
							<label class="col-sm-2 control-label">发布时间：</label>
							<div class="col-sm-9">
								<div id="datepicker" class="input-daterange input-group">
									<input type="text"  name="publishTime"  value="<fmt:formatDate value='${news.publishTime}' pattern='yyyy-MM-dd'/>" class="input-sm form-control">
								</div>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">摘要：</label>
							<div class="col-sm-9">
								<textarea name="newsDigest" rows="3" cols="93">${news.newsDigest}</textarea>
							</div>
						</div>
						
						<div class="form-group">
							<label class="col-sm-2 control-label">新闻内容:</label>
							<div class="col-sm-9">
								<textarea name="newsInfo" style="width:680px;height:400px;visibility:hidden;">
								<fns:encodes value="${news.newsInfo}" type="4"/>
								</textarea>
							</div>
						</div>
						<div class="form-group">
							<div class="col-sm-9 col-sm-offset-2">
								<button  class="btn btn-primary" id="news_confirm_btn" >提交</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>

<jsp:include page="/views/commons/footer.jsp"></jsp:include>

<link rel="stylesheet" href="<%=path %>/js/plugins/kindeditor/themes/default/default.css" />
<script charset="utf-8" src="<%=path %>/js/plugins/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="<%=path %>/js/plugins/kindeditor/lang/zh_CN.js"></script>

<script type="text/javascript">
	$(function() {
	var editor;
		KindEditor.ready(function(K) {
			editor = K.create('textarea[name="newsInfo"]', {
				allowFileManager: false,
				allowUpload : true,
				uploadJson:"<%=path %>/uncheck/pictures/upload/json",
				items : ['fontname', 'fontsize', '|',
				         'bold','italic', 'underline', 'forecolor','hilitecolor','link','|',
				         'justifyleft', 'justifycenter', 'justifyright','justifyfull','clearhtml', 'quickformat','|',
				         'image', 'table','emoticons','baidumap', '|', 'about'
				 ]
			});
		});
		$("#data_news_time .input-daterange").datepicker({
			keyboardNavigation: !1,
			forceParse: !1,
			autoclose: !0
		})
	})
	function insertNews(){
		$("#news_confirm_btn").addClass("disabled").attr("disabled","disabled").val("提交中");
		$.ajax({
			url : path + "/admin/news/update",
			type : "post",
			dataType : "json",
			data : $("#news_form").serialize(),
			success : function(data)
			{
				if(data.result){
					layer.msg("发布成功",{icon: 1});;
					window.location.href=path + "/views/news/news_list.jsp";
				}else{
					layer.msg(data.message,{icon: 2});;
					$("#news_confirm_btn").removeClass("disabled").removeAttr("disabled").val("提交");
				}
			},error:function(){
				layer.msg("服务器网络繁忙",{icon: 2});
				$("#news_confirm_btn").removeClass("disabled").removeAttr("disabled").val("提交");
			}
		});
	}
</script>
</body>
</html>